package com.ruoyi.web.controller.modules;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.modules.domain.TransportationCompany;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.modules.domain.VehicleMonthAuditData;
import com.ruoyi.modules.service.IVehicleMonthAuditDataService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 车辆月度审核视频Controller
 * 
 * @author ssh
 * @date 2024-12-15
 */
@RestController
@RequestMapping("/modules/vehicleMonthAudit/data")
public class VehicleMonthAuditDataController extends BaseController
{
    @Autowired
    private IVehicleMonthAuditDataService vehicleMonthAuditDataService;

    /**
     * 查询车辆月度审核视频列表
     */
    @PreAuthorize("@ss.hasPermi('modules:data:list')")
    @GetMapping("/list")
    public TableDataInfo list(VehicleMonthAuditData vehicleMonthAuditData)
    {
        startPage();
        List<VehicleMonthAuditData> list = vehicleMonthAuditDataService.selectVehicleMonthAuditDataList(vehicleMonthAuditData);
        return getDataTable(list);
    }

    /**
     * 导出车辆月度审核视频列表
     */
    @PreAuthorize("@ss.hasPermi('modules:data:export')")
    @Log(title = "车辆月度审核视频", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, VehicleMonthAuditData vehicleMonthAuditData)
    {
        List<VehicleMonthAuditData> list = vehicleMonthAuditDataService.selectVehicleMonthAuditDataList(vehicleMonthAuditData);
        ExcelUtil<VehicleMonthAuditData> util = new ExcelUtil<VehicleMonthAuditData>(VehicleMonthAuditData.class);
        util.exportExcel(response, list, "车辆月度审核视频数据");
    }

    /**
     * 获取车辆月度审核视频详细信息
     */
    @PreAuthorize("@ss.hasPermi('modules:data:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(vehicleMonthAuditDataService.selectVehicleMonthAuditDataById(id));
    }

    /**
     * 新增车辆月度审核视频
     */
    @PreAuthorize("@ss.hasPermi('modules:data:add')")
    @Log(title = "车辆月度审核视频", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody VehicleMonthAuditData vehicleMonthAuditData)
    {
        return toAjax(vehicleMonthAuditDataService.insertVehicleMonthAuditData(vehicleMonthAuditData));
    }

    /**
     * 修改车辆月度审核视频
     */
    @PreAuthorize("@ss.hasPermi('modules:data:edit')")
    @Log(title = "车辆月度审核视频", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody VehicleMonthAuditData vehicleMonthAuditData)
    {
        return toAjax(vehicleMonthAuditDataService.updateVehicleMonthAuditData(vehicleMonthAuditData));
    }

    /**
     * 删除车辆月度审核视频
     */
    @PreAuthorize("@ss.hasPermi('modules:data:remove')")
    @Log(title = "车辆月度审核视频", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(vehicleMonthAuditDataService.deleteVehicleMonthAuditDataByIds(ids));
    }

    /**
     * 获取所有运输公司月度审核视频统计数据
     */
    @PreAuthorize("@ss.hasPermi('modules:data:query')")
    @GetMapping(value = "/selectTranCompanyAuditCount")
    public TableDataInfo  selectTranCompanyAuditCount(Integer auditStatus){
            startPage();
            List<TransportationCompany> list = vehicleMonthAuditDataService.selectTranCompanyAuditCount(auditStatus);
            return getDataTable(list);
    }
}
